TO DO

* set seed to have same price paths across sessions.
* Caterina: at beginning of session change seed out of a choice of two.
* reinitialize state at beginning of each week

* when changing order of week with restrictions, make sure to also change conditions for showing pages with decision possible or not (i.e. if people choose restrictions or not)
* when changing order, change "r blocked", and change Alert (switch), Introduction (to say every two periods blocked), Endblock (reverted)
* if make a change in soft, make same change in hard

* programming robot
	a) compute Bayesian proba
	b) derive decisions buy/sell/hold
	c) add column appraising of decision (for blocked periods)
	d) implement decision in blocked periods by changing holdings as appropriate

* testing random numbers

import excel "C:\Users\alescia\Downloads\hard_treatment_automatic_2020-06-19.xlsx", sheet("Sheet1") firstrow
gen total_payoff= playerprice_a+ playerprice_b+ playerprice_c+50
twoway (line total_payoff subsessionround_number) (line playerprice_a subsessionround_number) (line playerprice_b subsessionround_number) (line playerprice_c subsessionround_number) if sessioncode=="as40zznm", by(playerid_in_group) xline(23 45, lcolor(green)) yline(0 100, lcolor(red))

DONE

* change message "2 consecutive periods of no trading" into just one
* change into 3x8 hours periods of trading if cannot solve notifications
* advance people manually every 8 hours if did not log in to trade in a period (maybe), or *time everything with reference to the end of the experiment*
* send email to people on a regular interval to remind them of the experiment (with personalized link to their id in the experiment)
* record if a page was submitted by timeout:
      def before_next_page(self):
        if self.timeout_happened:
            self.player.xyz = True
* why are there 65 periods and not 3*21?
* stop after 21 periods? --> no, move on.
* default to NO if no decision in third treatment
* acquisition price should be 100 in period 22, 43 --> show this when announcing new treatment
* change 0 previous price to NA

* for testing, change all so number of periods is 9 total
* make stock prices independent
* let people trade each each period
* be aware there are "hidden rounds" 1, 22, 43, and real rounds 2-21, 23-42, 44-65
* test still works if not connected

FOR CATERINA:

* Change Endblock.html to be more specific what the choice of the person is.
* Clarify Fin3 in the survey. Spell it out, not obvious it is related to previous question.
* REMEMBER THOSE ARE ONLY THE FIRST TWO TREATMENTS; AND WE NEED TO DO THE REVERSE TREATMENTS WHERE RESTRICTIONS ARE IN THE FIRST PHASE
* Let's think of a possible "robo-adviser" treatment which always advises to buy if up and sell if down, since this is the best possible strategy. Or does automatic trading unless stopped doing so.

COMMAND REMINDERS

#to test experiment:

otree devserver
Then open your browser to http://localhost:8000 to try out the survey.

# to run robots

In your session config, set use_browser_bots=True.
then run server
to run on the command line (not on server) then
otree test mysession 100
if want to run 100 people
add --export if want file with record
